import React, { Component } from 'react';

import styles from './index.less';

export default class ExampleMenus extends Component {
  constructor(props) {
    super(props);
  }

  getMenus() {
    const module = require.context('../../../../components', true, /index\.md$/);
    const list = module.keys();
    const maps = [];
    for (const key of list) {
      const map = {};
      map.module = module(key).default;
      const match = key.match(/^\.\/([^_][\w-]+)\/index\.md?$/);
      if (match && match[1]) {
        map.name = match[1];
        map.path = basePath + map.name;
        map.title = menuConfig[map.name].zh;
      } else {
        map.name = '';
        map.path = basePath;
      }
      maps.push(map);
    }
    console.log(maps);
    return maps;
  }

  render() {
    return <div className={styles.menus}>123</div>;
  }
}
